// -----------------------------------------------
// Author:     code34 nicolas_boiteux@yahoo.fr, Xeno - domination
// Edited by:  Neumatic
// Warcontext: Create a mission info dialog box
// -----------------------------------------------

private ["_objective","_missionnumber","_info","_teampromote","_ctrl"];

disableSerialization;
_ctrl = (findDisplay 10000) displayCtrl 10004;

//A3 TODO: Headbug
WC_fnc_fixheadbug = {
	private ["_pos","_vehicle"];
	closeDialog 0;
	titleCut ["", "BLACK IN", 1];
	_pos = getPosATL player;
	_vehicle = createVehicleLocal ["Lada1", [0,0,0], [], 0, "NONE"];
	player moveInCargo _vehicle;
	deleteVehicle _vehicle;
	player setPos _pos;
};

playSound "paper";

ctrlSetText [10001, format [localize "STR_WC_BRIEFING", (wclevelmax - 1)]];

if (!isNil "wcenemykilled") then {
	ctrlSetText [10005, format [localize "STR_WC_ENNEMYKILLED", wcenemykilled]];
} else {
	wcenemykilled = 0;
	ctrlSetText [10005, format [localize "STR_WC_ENNEMYKILLED", wcenemykilled]];
};

ctrlSetText [10007, format [localize "STR_WC_IASKILL", (wcskill * 100)] + "%"];
ctrlSetText [10012, format [localize "STR_WC_TEAMSCORE", wcteamscore]];
ctrlSetText [10011, format [localize "STR_WC_AMMOUSED", (wcammoused - 1)]];
ctrlSetText [10013, format [localize "STR_WC_REVIVELEFT", R3F_REV_nb_reanimations]];

if (!isNil "wcobjective") then {
	_missionnumber = (wcobjective select 2);
	switch (_missionnumber) do {
		case 51: {
			_objective = format [localize "STR_WC_MISSION51", getText (configFile >> "CfgVehicles" >> typeOf (wcobjective select 1) >> "DisplayName")];
		};
		case 52: {
			_objective = format [localize "STR_WC_MISSION52", getText (configFile >> "CfgVehicles" >> typeOf (wcobjective select 1) >> "DisplayName")];
		};
		case 53: {
			_objective = format [localize "STR_WC_MISSION53", getText (configFile >> "CfgVehicles" >> typeOf (wcobjective select 1) >> "DisplayName")];
		};
		default {
			_objective = localize (format["STR_WC_MISSION%1", _missionnumber]);
		};
	};

	ctrlSetText [10006, format ["%1\n\n%2", wcobjective select 3, _objective]];
} else {
	ctrlSetText [10006, format [localize "STR_WC_OPERATIONGOAL", localize "STR_WC_NOTYETDEFINE"]];
};

hintSilent wcteamspeak;

switch (wcteamlevel) do {
	case 1: {_info = localize "STR_WC_HEROETEAM"};
	case 2: {_info = localize "STR_WC_ELITETEAM"};
	case 3: {_info = localize "STR_WC_EXPERIENCEDTEAM"};
	case 4: {_info = localize "STR_WC_CONFIRMEDTEAM"};
	case 5: {_info = localize "STR_WC_NOOBTEAM"};
	case 6: {_info = localize "STR_WC_CALAMITYTEAM"};
	case 7: {_info = localize "STR_WC_BASTARDTEAM"};
	case 8: {_info = localize "STR_WC_ASSHOLETEAM"};
};

if (wckindofserver != 3) then {
	if ((name player) in wcinteam) then {
		_teampromote = localize format ["STR_WC_TEAM%1", wcteamlevel];
		ctrlSetText [10009, format ["%3 : %1\n\n%2", _teampromote, _info, localize "STR_WC_ACTUALLYYOURTEAMRANK"]];
	};
};